<?php

// var_dump($_REQUEST);

$str = ' zxcvgsdg gfsgfs    sdfsfg    ';
var_dump($str);
// exit;

echo test($str);
function test($str)
{
 $search = array(" ","　");
 $replace = array("","");
 return str_replace($search, $replace, $str);
}

// 方式A:
$string = '　测试 ';
$ret1 = trim(trim($string,"　"));
var_dump($ret1);

// 方式B:
$string = '　测试 ';
$ret2 = trim(str_replace('　', '  ', $string));
var_dump($ret2);

/**
 * [filterBlank 去掉字符串两边空格]
 */
function filterBlank( $str ) 
{
    mb_regex_encoding('utf-8');
    $str = mb_ereg_replace('　', '', $str);
    return trim($str);
}
$str = 'jkgsdgsgsdgs gsdg gsd';
echo filterBlank($str);